#include <stm8s_tim2.h>

uint16_t TIM2_GetCounter(void)
{
  uint16_t tmpcntr = 0;
  
  tmpcntr =  ((uint16_t)TIM2->CNTRH << 8);
  /* Get the Counter Register value */
  return (uint16_t)( tmpcntr| (uint16_t)(TIM2->CNTRL));
}

/**
  * @brief  Gets the TIM2 Prescaler value.
  * @param  None
  * @retval Prescaler Register configuration value  @ref TIM2_Prescaler_TypeDef.
  */
